/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.wisnu.ebs.view;

import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;

/**
 *
 * @author Wisnu Wardoyo <mas.wisnu99@gmail.com>
 */
public class menuControll extends javax.swing.JPanel {

    /**
     * Creates new form menuControll
     */
    Image image = new ImageIcon("./src/icon/bg.png").getImage();

    public menuControll() {
        initComponents();
    }
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        key = new javax.swing.JLabel();
        answer = new javax.swing.JLabel();
        result = new javax.swing.JLabel();
        print = new javax.swing.JLabel();
        exit = new javax.swing.JLabel();

        setMinimumSize(new java.awt.Dimension(520, 76));
        setPreferredSize(new java.awt.Dimension(520, 76));

        key.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        key.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/key_icon.png"))); // NOI18N
        key.setMaximumSize(new java.awt.Dimension(70, 70));
        key.setMinimumSize(new java.awt.Dimension(70, 70));
        key.setName(""); // NOI18N
        key.setPreferredSize(new java.awt.Dimension(70, 70));
        key.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                keyMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                keyMouseExited(evt);
            }
        });

        answer.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        answer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/answer_icon.png"))); // NOI18N
        answer.setMaximumSize(new java.awt.Dimension(70, 70));
        answer.setMinimumSize(new java.awt.Dimension(70, 70));
        answer.setName(""); // NOI18N
        answer.setPreferredSize(new java.awt.Dimension(70, 70));

        result.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        result.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/result_icon.png"))); // NOI18N
        result.setMaximumSize(new java.awt.Dimension(70, 70));
        result.setMinimumSize(new java.awt.Dimension(70, 70));
        result.setName(""); // NOI18N
        result.setPreferredSize(new java.awt.Dimension(70, 70));

        print.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        print.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/printer_icon.png"))); // NOI18N
        print.setMaximumSize(new java.awt.Dimension(70, 70));
        print.setMinimumSize(new java.awt.Dimension(70, 70));
        print.setName(""); // NOI18N
        print.setPreferredSize(new java.awt.Dimension(70, 70));

        exit.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        exit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/exit_icon.png"))); // NOI18N
        exit.setMaximumSize(new java.awt.Dimension(70, 70));
        exit.setMinimumSize(new java.awt.Dimension(70, 70));
        exit.setName(""); // NOI18N
        exit.setPreferredSize(new java.awt.Dimension(70, 70));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(55, 55, 55)
                .addComponent(key, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(15, 15, 15)
                .addComponent(answer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(15, 15, 15)
                .addComponent(result, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(15, 15, 15)
                .addComponent(print, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(15, 15, 15)
                .addComponent(exit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(55, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(key, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(answer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(result, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(print, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(exit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 6, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void keyMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_keyMouseEntered
        hover(key, "key_icon");
    }//GEN-LAST:event_keyMouseEntered

    private void keyMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_keyMouseExited
        noHover(key, "key_icon");
    }//GEN-LAST:event_keyMouseExited


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel answer;
    private javax.swing.JLabel exit;
    private javax.swing.JLabel key;
    private javax.swing.JLabel print;
    private javax.swing.JLabel result;
    // End of variables declaration//GEN-END:variables
    @Override
    public void paintComponent(Graphics g) {
        g.drawImage(image, 0, 0, null);
    }
    
    private void hover(javax.swing.JLabel label, String icon){
        label.setIcon(new ImageIcon("./src/icon/"+icon+"Hover.png"));
        repaint();
    }
    private void noHover(javax.swing.JLabel label, String icon){
        label.setIcon(new ImageIcon("./src/icon/"+icon+".png"));
        repaint();
    }
}
